1. Field of the Invention
The present invention relates to a technique of composing a plurality of images shot under different exposure conditions so as to generate an image having a wide dynamic range.
2. Description of the Related Art
There exists a method of shooting a plurality of images with little highlight-detail loss and images with little shadow-detail loss under different exposure conditions and composing the images to generate an image having a wide dynamic range. In this image composition processing, the images are composed after level adjustment according to exposure amounts has been performed between over-exposure images and under-exposure images.
A focal plane shutter that adjusts the exposure time using the traveling interval between the front curtain and the rear curtain is known to cause an exposure error when the traveling speed of the front curtain and that of the rear curtain have a difference (curtain speed unevenness), and the exposure time changes between the two ends of the screen. In particular, the curtain speed unevenness readily occurs at a high shutter speed. At a low shutter speed, the influence of the curtain speed unevenness is small. Japanese Patent Laid-Open No. 2003-078815 or 2008-079209 proposes a technique of correcting an exposure error caused by the curtain speed unevenness.
When controlling a lens or a stop, a phenomenon called shading is known in which the peripheral portion of an image becomes darker than the center. A technique of correcting the shading has also been proposed (for example, Japanese Patent Laid-Open No. 2002-290829).
When composing a plurality of images, an exposure error may occur according to the position on the screen due to the curtain speed unevenness or shading. Even when gain adjustment is done all over the screen, the level cannot match depending on the position on the screen, and a moving area may erroneously be detected.
FIG. 13 shows the configuration of a conventional apparatus. Reference numerals 1301 to 1305 and 1308 to 1315 correspond to reference numerals 101 to 105 and 108 to 115 in the first embodiment (FIG. 1) to be described later. The main functions will be described below assuming that, for example, the exposure amount setting unit 1303 sets the exposure step of under-exposure to −2 steps with respect to correct exposure and the exposure step of over-exposure to +2 steps with respect to correct exposure.
The level setting unit 1307 sets a 4-times level matching gain value in the level gain processing unit 1309 for under-exposure image data. Similarly, the level setting unit 1306 sets a ¼ level matching gain value in the level gain processing unit 1308 for over-exposure image data. The motion detection unit 1310 compares the under-exposure image data and the over-exposure image data, which have undergone the level matching, and detects motion information in the images.
FIGS. 14A to 14D show the pixel level distributions of shot images. The abscissa represents the position on the screen along the shutter traveling direction (normally, the vertical direction of the screen), and the ordinate represents the pixel level at that position. The dotted lines in FIGS. 14A to 14D indicate the pixel level of correct exposure.
FIG. 14A shows the pixel level distribution of an under-exposure image shot using a high-speed shutter, immediately after shooting. Since the image is an under-exposure image, the pixel level is lower than that of correct exposure and changes depending on the position on the screen because of the influence of curtain speed unevenness.
FIG. 14B shows the pixel level distribution of an over-exposure image shot using a low-speed shutter, immediately after shooting. Since the image is an over-exposure image, the pixel level is higher than that of correct exposure and constant at any position on the screen because there is little influence of curtain speed unevenness.
FIGS. 14C and 14D show results obtained by performing level matching according to the exposure amount to compose the under-exposure image and the over-exposure image. FIG. 14C shows the result of level matching of the under-exposure image. The pixel level is correct near the screen center but not at the two ends of the screen. FIG. 14D shows the result of level matching of the over-exposure image. The pixel level is correct all over the screen.
Conventional motion detection is performed based on the pixel level distributions shown in FIGS. 14C and 14D. The motion detection can normally be done near the screen center. However, since the pixel values have a difference between the two ends of the screen, a motionless area is erroneously detected as a moving area.
FIGS. 15A to 15D show the pixel level distributions of images with shading. The abscissa represents the distance from the screen center, and the ordinate represents the pixel level at that distance. The dotted lines in FIGS. 15A to 15D indicate the pixel level of correct exposure.
FIG. 15A shows the pixel level distribution of an under-exposure image shot in a stopped-down-aperture state, immediately after shooting. FIG. 15B shows the pixel level distribution of an over-exposure image shot in a full-aperture state, immediately after shooting. In both images, the pixel level decreases in accordance with the distance from the screen center due to the influence of shading. However, since the influence of shading changes in general depending on the f-number, the degree of decrease changes between FIGS. 15A and 15B.
FIGS. 15C and 15D show results obtained by performing level matching according to the exposure amount to compose the under-exposure image and the over-exposure image. In this case, the pixel level is correct near the screen center but not at the peripheral portion of the screen because of the different influence of shading. For this reason, motion detection can normally be done near the screen center. However, since the pixel values have a difference at the peripheral portion of the screen, a motionless area is erroneously detected as a moving area.
In Japanese Patent Laid-Open No. 2003-078815 or No. 2008-079209 described above, to detect curtain speed unevenness, a reference image such as a wall or white paper needs to be shot in advance. This is inadequate for correcting curtain speed unevenness in every shooting.
In Japanese Patent Laid-Open No. 2002-290829, a plurality of correction tables used for shading correction need to be prepared in accordance with the focal length or f-number at the time of shooting. This is not suitable for a single-lens reflex camera capable of variously exchanging the lens. In addition, since shading correction is performed for each of two shot images, processing is complicated.